home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-10-15 | 1.5 KB | 49 lines | [TEXT/MPS ] |
- #
- # File: KeyboardChaos.vu
- #
- # Contains: A very simple VU script that illustrates the use of the system tasks
- # random(), and typeSpeed(). Simply run it against any target machine.
- # For efficiency, it will generate the list of keycodes to send to the
- # target before sending them off. The theSeed variable sets the random
- # seed used when creating a random number. To repeat a series of random
- # numbers, set the theSeed parameter to the same value as a pervious test.
- #
- # Conventions: Global variables begin with a "g"
- #
- # Written by: David Gaxiola
- #
- # Copyright: © 1990-1992 by Apple Computer, Inc., all rights reserved.
- #
- # Change History:
- #
- # 8/19/92 DGG Made script parametric, added random seed ability.
- # 7/1/92 DGG creation
- #
- # To Do:
- #
-
- script KeyboardChaosMain(gNumberOfSets := 20, gMaxNumberPerSet := 30,
- gMinTypeSpeed := 50, gMaxTypeSpeed := 120,
- gKeycodeMin := 0, gKeycodeMax := 55, theSeed )
- begin
- if IsUndefined(theSeed)
- theSeed := Random();
- println "The random seed is ", theSeed;
- RandomSeed(theSeed);
-
- for counter := 1 to gNumberOfSets
- begin
- println "Starting set ", counter;
- numberThisSet := Random(1, gMaxNumberPerSet);
- TypeSpeed(Random(gMinTypeSpeed, gMaxTypeSpeed));
- theKeycodeList := {};
- for counter2 := 1 to numberThisSet
- begin
- theKeycode := Random(gKeycodeMin, gKeycodeMax);
- theKeycodeList := Insert(theKeycode, 1, theKeycodeList);
- end;
- type c:theKeycodeList;
- println theKeycodeList;
- end;
- end;
-